package com.reremouse.rerebbs.dao.impl;

import com.reremouse.model.SystemConfig;
import com.reremouse.rerebbs.dao.ISystemConfigDAO;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import java.io.Serializable;

public class SystemConfigDAO
        implements ISystemConfigDAO, Serializable {
    @PersistenceContext
    private EntityManager entityManager;

    public EntityManager getEntityManager() {
        return this.entityManager;
    }

    public void setEntityManager(EntityManager entityManager) {
        this.entityManager = entityManager;
    }

    public SystemConfig getSystemConfig() {
        String q = "Select ais from SystemConfig ais";
        SystemConfig ais = (SystemConfig) this.entityManager.createQuery(q).getSingleResult();
        return ais;
    }

    public void updateSystemConfig(SystemConfig n) {
        this.entityManager.merge(n);
    }

    public void saveTheme(String theme) {
        SystemConfig ssc = getSystemConfig();
        ssc.setTheme(theme);
        this.entityManager.merge(ssc);
    }
}



/* Location:           F:\jsp源码\蝙蝠论坛系统\rerebbs\WEB-INF\classes\

 * Qualified Name:     com.reremouse.rerebbs.dao.impl.SystemConfigDAO

 * JD-Core Version:    0.7.0.1

 */